package com.acegear.horizon.domain.models.vo;

import com.acegear.horizon.ApplicationContextProvider;
import com.acegear.horizon.domain.models.jpa.UserEmail;
import com.acegear.horizon.domain.models.jpa.UserInfo;
import com.acegear.horizon.domain.models.jpa.UserPhone;
import com.acegear.horizon.utils.JwtTokenUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Created by wangsike on 2016/12/17.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserInfoTokenVO {
	private Long cludId;
    private Long userId;
    private String role;
    private String jwt;
    private UserInfo userInfo;
    private UserPhone userPhone;
    private UserEmail userEmail;
    private Boolean regist;

    public UserInfoTokenVO(Long cludId,Long userId,
                           String accessToken,
                           String role,
                           UserInfo userInfo,
                           UserPhone userPhone,
                           UserEmail userEmail) {
    	this.cludId = cludId;
        this.userId = userId;
        this.role = role;
        JwtTokenUtil jwtTokenUtil = ApplicationContextProvider.getBean(JwtTokenUtil.class);
        this.jwt = jwtTokenUtil.generateToken(userId.toString(), accessToken, role);
        this.userInfo = userInfo;
        this.userPhone = userPhone;
        this.userEmail = userEmail;
        this.regist = false;
    }

    public Long getCludId() {
		return cludId;
	}

	public void setCludId(Long cludId) {
		this.cludId = cludId;
	}

	public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getJwt() {
        return jwt;
    }

    public void setJwt(String jwt) {
        this.jwt = jwt;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public UserPhone getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(UserPhone userPhone) {
        this.userPhone = userPhone;
    }

    public UserEmail getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(UserEmail userEmail) {
        this.userEmail = userEmail;
    }

    public Boolean getRegist() {
        return regist;
    }

    public void setRegist(Boolean regist) {
        this.regist = regist;
    }
}
